package com.luoyuanxiangvip.web.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.luoyuanxiangvip.common.utils.AjaxResult;
import com.luoyuanxiangvip.common.vo.support.QueryPage;
import com.luoyuanxiangvip.core.entity.BizCategory;
import com.luoyuanxiangvip.core.service.IBizCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author luoyuanxiang <p>luoyuanxiangvip.com</p>
 * @since 2019-05-26
 */
@RestController
@Api(description = "类别管理")
public class BizCategoryController {

    @Resource
    @Lazy
    private IBizCategoryService iBizCategoryService;

    @PostMapping("/category/list")
    @ApiOperation(value = "获取分类列表")
    public AjaxResult categoryList(@RequestBody QueryPage queryPage) {
        IPage<BizCategory> page = iBizCategoryService.page(new Page<>(queryPage.getPage(), queryPage.getLimit()));
        return AjaxResult.success("获取分类列表成功", page);
    }
}
